<?php
class important extends connector {

	function important() {
		$this->softbase(true);
	}
	//搜索酒店附近标志性坐标
	function onsearchnearby() {
		$citycode = $this->fun->accept('citycode', 'G');
		$searchname = $this->fun->accept('searchname', 'G');
		$res = $this->get_hotel_nearby($citycode,$searchname);
		include_once admin_ROOT . 'public/class_json.php';
		$isjson = function_exists('json_decode')? true : false;
		$jsonstr = "";
		if($isjson) {
			$jsonstr = json_encode($res);
		} else {
			$json = new json();
			$jsonstr = $json->jsonEncode($res);
		}
		echo $jsonstr;
		exit;
	}
	//酒店搜索
	function onhotelsearch() {
		parent::start_template();
		$MinPageid = intval($this->fun->accept('MinPageid', 'R'));
		$page_id = intval($this->fun->accept('page_id', 'R'));  //当前页
		$countnum = intval($this->fun->accept('countnum', 'R'));
		$MaxPerPage = intval($this->fun->accept('MaxPerPage', 'R'));  //每页多少条
		if (empty($MaxPerPage)) {
			$MaxPerPage = $this->CON['max_list'];
		}
		$cityname = $this->fun->accept('cityname', 'R');
		$cityid = $this->fun->accept('cityid', 'R');
		$checkindate = $this->fun->accept('checkindate', 'R');
		$checkoutdate  = $this->fun->accept('checkoutdate', 'R');
		$lowerprice = $this->fun->accept('lowerprice', 'R');
		$heightprice  = $this->fun->accept('heightprice', 'R');
		$hotelnearby  = $this->fun->accept('hotelnearby', 'R');
		$coordinate  = $this->fun->accept('coordinate', 'R');
		$lng=$lat=$radius="";
		if($coordinate) {
			$cooarr = explode(',',$coordinate);
			$lng = $cooarr[0];
			$lat = $cooarr[1];
			$radius = $cooarr[2];
		}
		$hotelname  = $this->fun->accept('hotelname', 'R');
		$hotelstar = $this->fun->accept('hotelstar', 'R');
		$ser = $this->fun->accept('ser', 'R');
		$param = array(
			'CityId'          =>$cityid,
			'DistrictId'      =>'', //行政区
			'BusinessZoneId'  =>'', //商业区
			'Categories'      =>intval($hotelstar)+1,
			'Keyword'         =>$hotelname,
			'Landmark'        =>$hotelnearby,
			'Lng'             =>$lng,
			'Lat'             =>$lat,
			'Radius'          =>$radius,
			'BroadbandService'=>$ser,
			'LowestPrice'     =>$lowerprice,
			'HighestPrice'    =>$heightprice,
			'CheckInDate'     =>$checkindate,
			'CheckOutDate'    =>$checkoutdate,
			'SortType'        =>'',
			'PageSize'        =>$MaxPerPage,
			'PageIndex'       =>$page_id
		);
		$arr = $this->get_hotel_search($param);
		if (!empty($countnum)) {
			$countnum = $arr['TotalItemCount'];
			exit($countnum);
		}
		$this->ectemplates->display('hotel/hotel_search_list');
	}
	//酒店显示
	function onhotelshow() {
		
	}
	//掉用房型
	function onroomtype() {
		
	}
	//酒店所属公司
	function onhotelcompany() {
		
		
	}
	//信用卡担保
	function onguaranteetype() {
		
		
	}
}
?>